/**
 * @file   1085.cpp
 * @author Shuang Hu <hsmath@ubuntu>
 * @date   Sat Apr 24 03:35:08 2021
 * 
 * @brief  PAT 1085:Find perfect sequence
 * 
 * 
 */
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    long int N,p;
    cin>>N>>p;
    vector<long int> seq;
    for(int i=0;i<N;i++){
	long int num;
	cin>>num;
	seq.push_back(num);
    }
    sort(seq.begin(),seq.end());
    int frontptr=0;
    int rearptr=0;
    long int nowmax=0;
    while(rearptr<seq.size()){
	long int m=seq[frontptr];
	long int r=m*p;
	while(rearptr<seq.size()){
	    if(seq[rearptr]>r){
		break;
	    }else{
		rearptr++;
	    }
	}
	if(rearptr-frontptr>nowmax){
	    nowmax=rearptr-frontptr;
	}
	frontptr++;
    }
    cout<<nowmax<<endl;
}
